<?php
class ProjectAction extends Action
{
    /**
    +----------------------------------------------------------
    *教师信息添加
    +----------------------------------------------------------
    */
   public  function projectadd()
   {
        $pro=M("project");
        $pro->create();
        $pro_result=$pro->add();
        if($pro_result)
        {
            $this->assign("jumpUrl","projectadd");
            $this->success("项目信息添加成功");
        }
        else
        {
              $this->display();
        }
   }
    /**
    +----------------------------------------------------------
    *教师信息列表
    +----------------------------------------------------------
    */
    public function projectlist()
    {
         $prolist=M("project");
         $prolist_result=$prolist->field("pj_id,pj_name,pj_grade,pj_teacher,pj_begin_baoming,pj_begin_shangke")->select();
         $this->assign("prolistshow",$prolist_result);
         $this->display();
    }
    /**
    +----------------------------------------------------------
    *教师信息编辑
    +----------------------------------------------------------
    */
     public function projectedit()
    {
        $proedit=M("project");
        if(isset($_GET['e_id']))
        {
            $e_id=$_GET['e_id'];
            $edit_result= $proedit->where("pj_id=$e_id")->field("pj_name,pj_grade,pj_teacher,pj_begin_baoming,pj_begin_shangke")->limit(1)->find();
            $this->assign('e_id',$e_id);
            $this->assign('edit_result',$edit_result);
            print_r($edit_result);
            $this->display(projectedit);
        }
        //更新类别信息
        if(isset($_POST['u_e_id']))
        {
            $u_e_id=$_POST['u_e_id'];
            $proedit->create();
            $info=$proedit->where("pj_id=$u_e_id")->save();
            if($info)
            {
                $this->assign("jumpUrl","projectlist");
                $this->success("信息修改成功!");
            }

        }
     }
     /**
    +----------------------------------------------------------
    *删除教师信息
    +----------------------------------------------------------
    */
      public function projectdel()
    {
        $prodel=M("project");
        if(isset($_GET['d_id']))
        {
            $d_id=$_GET['d_id'];
            $del_result= $prodel->where("pj_id=$d_id")->delete();
            if($del_result)
            {
                $this->assign("jumpUrl","__URL__/projectlist");
                $this->success("信息删除成功!");
            }
        }

     }

}
?>
